﻿<Window x:Class="DTC.Popups.DrugsDictionaryPopup"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:DTC.Popups"
        Title="Препараты" Height="680" MinWidth="750"
        Style="{StaticResource PopupWindow}"
        SizeToContent="Width">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/ListBoxStyles.xaml"/>
                <ResourceDictionary Source="../Resources/ButtonsStyles.xaml"/>
                <ResourceDictionary Source="../Resources/TextBlockStyles.xaml"/>
                <ResourceDictionary Source="../Resources/BorderStyles.xaml"/>
				<ResourceDictionary Source="../Resources/ToolTipStyles.xaml"/>
                <ResourceDictionary Source="../Resources/ExpanderStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel LastChildFill="True" Margin="15" >
        <Grid DockPanel.Dock="Left">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="0.5*"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="0.5*"/>
        </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" MinWidth="200"
                       Text="Список препаратов"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"/>
            <ListBox Name="DrugsListBox" 
                     Grid.Row="1" Grid.Column="0"
                     VerticalAlignment="Stretch"                    
                     ItemContainerStyle="{StaticResource ColorListBoxItem}"
                     HorizontalContentAlignment="Stretch"
                     SelectionChanged="DrugsListBox_SelectionChanged">
            <ListBox.ItemTemplate>
                    <DataTemplate>
						<Grid Height="35">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="11"/>
							</Grid.ColumnDefinitions>
                        	<Border Margin="4,4,0,4"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3">
                            	<TextBlock Text="{Binding Path=Name}" 
                                	       HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        	</Border>
							<Button Name="DeleteDrugButton"
									Grid.Column="1"
									Height="16"
									Width="11"
									Margin="2,0,0,0"
									Style="{StaticResource DelRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Bottom"
                                    Click="DeleteDrugButton_Click" Tag="{Binding}"
                                    >
								<Button.ToolTip>
									<ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-22">
											<TextBlock Text="Удалить"/>
									</ToolTip>
								</Button.ToolTip>
							</Button>		
							<Button Name="ViewDrugButton"
									Grid.Column="1"
									Height="16"
									Width="11"
									Margin="2,0,0,0"
									Style="{StaticResource ViewRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Top"
                                    Click="ChangeDrugButton_Click"
                                    Tag="{Binding}">		
									<Button.ToolTip>
									<ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-22">
											<TextBlock Text="Изменить"/>
									</ToolTip>
								</Button.ToolTip>
							</Button>
						</Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>    
            </ListBox>
            <Border Grid.Row="1" Grid.Column="0"
                    Style="{StaticResource ListBoxControlPanel}"
                    Width="23" Margin="1,1,0,1"
                    HorizontalAlignment="Left">            
                <Button Name="AddDrugButton"
                        Click="AddDrugButton_Click"
                        Margin="0,5,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Height="17" Width="17"
                        Style="{StaticResource SearchButton}">
					<Button.ToolTip>
						<ToolTip Style="{StaticResource DefaultToolTipStyle}"
								Height="46"
								Width="75"
								VerticalOffset="-29">
							<StackPanel VerticalAlignment="Center"
										HorizontalAlignment="Center">
								<TextBlock Text="Добавить"
											Foreground="Black"
											HorizontalAlignment="Center"/>
								<TextBlock Text="препарат"
											Foreground="Black"
											HorizontalAlignment="Center"/>
							</StackPanel>
						</ToolTip>
					</Button.ToolTip>
				</Button>
            </Border>
            <TextBlock Text="Формы выпуска"
                       Grid.Row="2" Grid.Column="0"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"/>
            <ListBox Name="IssueFormsListBox"
                     Grid.Row="3" Grid.Column="0"
                     VerticalAlignment="Stretch"
					 ItemContainerStyle="{StaticResource ColorListBoxItem}"
                     HorizontalContentAlignment="Stretch">
                <ListBox.ItemTemplate>
                    <DataTemplate>
						<Grid Height="35">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="11"/>
							</Grid.ColumnDefinitions>
                        	<Border Margin="4,4,0,4"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3">
                            	<TextBlock Text="{Binding Path=Name}" 
                                	       HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        	</Border>
							<Button Name="DeleteIssueFormButton"
									Grid.Column="1"
									Height="16"
									Width="11"
									Margin="2,0,0,0"
									Style="{StaticResource DelRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Bottom"
                                    Click="DeleteIssueFormButton_Click"
                                    Tag="{Binding}">
									<Button.ToolTip>
									<ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-22">
											<TextBlock Text="Удалить"/>
									</ToolTip>
								</Button.ToolTip>
							</Button>
							<Button Name="ViewIssueFormButton"
									Grid.Column="1"
									Height="16"
									Width="11"
									Margin="2,0,0,0"
									Style="{StaticResource ViewRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Top"
                                    Click="ViewIssueFormButton_Click"
                                    Tag="{Binding}">		
									<Button.ToolTip>
									<ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="73"
												VerticalOffset="-22">
											<TextBlock Text="Изменить"/>
									</ToolTip>
								</Button.ToolTip>
							</Button>
						</Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>    
            </ListBox>
            <Border Grid.Row="3" Grid.Column="0"
                    Style="{StaticResource ListBoxControlPanel}"
                    Width="23" Margin="1,1,0,1"
                    HorizontalAlignment="Left">            
                <Button Name="AddIssueFormButton"
                        Click="AddIssueFormButton_Click"
                        Margin="0,5,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Height="17" Width="17"
                        Style="{StaticResource SearchButton}">
						<Button.ToolTip>
						<ToolTip Style="{StaticResource DefaultToolTipStyle}"
								Height="46"
								Width="115"
								VerticalOffset="-29">
							<StackPanel VerticalAlignment="Center"
										HorizontalAlignment="Center">
								<TextBlock Text="Добавить"
											Foreground="Black"
											HorizontalAlignment="Center"/>
								<TextBlock Text="форму выпуска"
											Foreground="Black"
											HorizontalAlignment="Center"/>
							</StackPanel>
						</ToolTip>
					</Button.ToolTip>
				</Button>
            </Border>
        </Grid>
        <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" MinWidth="200"
                       Text="Способы упаковки"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"/>
                <ListBox Name="BoxesListBox"
                     Grid.Row="1"
                         Width ="450"
                     Margin="10,0,10,0"
                     VerticalAlignment="Stretch"
					 ItemContainerStyle="{StaticResource ColorListBoxItem}"
                     HorizontalContentAlignment="Stretch">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Height="80">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="0.5*"/>
                                    <ColumnDefinition Width="0.5*"/>
                                    <ColumnDefinition Width="12"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.4*"/>
                                    <RowDefinition Height="0.6*"/>
                                </Grid.RowDefinitions>
                                <Border Margin="4,4,2,4"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3"
									Grid.Column="0"
									Grid.RowSpan="2">
                                    <StackPanel HorizontalAlignment="Center"
												VerticalAlignment="Center" Margin="3">
                                        <TextBlock Text="{Binding Path=Drug.Name}" 
                                                   HorizontalAlignment="Center" 
                                                   VerticalAlignment="Center"/>
                                        <TextBlock Text="Производитель:"
                                                   Foreground="Gray"
                                                   FontSize="10"
                                                   HorizontalAlignment="Center"
                                                   VerticalAlignment="Center"/>
                                        <TextBlock Text="{Binding Path=DTCManufacturer.Name}"
                                                   HorizontalAlignment="Center" 
                                                   VerticalAlignment="Center"/>
                                    </StackPanel>
                                </Border>
                                <Border Margin="2,4,4,2"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3"
									Grid.Column="1">
                                    <WrapPanel HorizontalAlignment="Center"
                                               VerticalAlignment="Center"
                                               Margin="3">
                                        <TextBlock Text="Форма выпуска:"
                                                   Foreground="Gray"
                                                   FontSize="10"
                                                   HorizontalAlignment="Left"
                                                   VerticalAlignment="Bottom"/>
                                        <TextBlock Text="{Binding Path=IssueFormName, Mode=OneWay}" 
                                                   Margin="5,0,0,0"
                                                   HorizontalAlignment="Center" 
                                                   VerticalAlignment="Bottom"/>
                                    </WrapPanel>
                                </Border>
                                <Border Margin="2,2,4,4"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3"
									Grid.Column="1"
									Grid.Row="1">
                                        <WrapPanel Margin="5" 
                                                   VerticalAlignment="Center" 
                                                   HorizontalAlignment="Center">
                                            <TextBlock Text="Количество в упаковке:"
                                                       Foreground="Gray"
                                                       FontSize="10"
                                                       HorizontalAlignment="Center"
                                                       VerticalAlignment="Bottom"/>
                                            <TextBlock Text="{Binding Path=FormatedDrug}" 
                                                       HorizontalAlignment="Center" 
                                                       VerticalAlignment="Bottom"
                                                       Margin="5,0,0,0"/>
                                    </WrapPanel>
                                </Border>
								<Grid Grid.Column="2"
									Grid.RowSpan="2">
									<Grid.RowDefinitions>
										<RowDefinition Height="0.5*"/>
										<RowDefinition Height="0.5*"/>
									</Grid.RowDefinitions>
                                <Button Name="DeleteBoxButton"
									Grid.Row="1"
									Height="37"
									Width="12"
									Margin="2,0,0,0"
									Style="{StaticResource DelRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Bottom"
                                    Click="DeleteBoxButton_Click"
                                    Tag="{Binding}">
                                    <Button.ToolTip>
                                        <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-27">
                                            <TextBlock Text="Удалить"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
                                <Button Name="ViewBoxButton"
									Grid.Row="0"
									Height="37"
									Width="12"
									Margin="2,0,0,0"
									Style="{StaticResource ViewRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Top"
                                    Click="ViewBoxButton_Click"
                                    Tag="{Binding}">
                                    <Button.ToolTip>
                                        <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-27">
                                            <TextBlock Text="Изменить"/>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
								</Grid>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <Border Grid.Row="1"
                    Style="{StaticResource ListBoxControlPanel}"
                    Width="23" Margin="11,1,0,1"
                    HorizontalAlignment="Left">
                    <Button Name="AddBoxButton"
                        Click="AddBoxButton_Click"
                        Margin="0,5,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Height="17" Width="17"
                        Style="{StaticResource SearchButton}">
                        <Button.ToolTip>
                            <ToolTip Style="{StaticResource DefaultToolTipStyle}"
								Height="46"
								Width="120"
								VerticalOffset="-29">
                                <StackPanel VerticalAlignment="Center"
										HorizontalAlignment="Center">
                                    <TextBlock Text="Добавить"
											Foreground="Black"
											HorizontalAlignment="Center"/>
                                    <TextBlock Text="способ упаковки"
											Foreground="Black"
											HorizontalAlignment="Center"/>
                                </StackPanel>
                            </ToolTip>
                        </Button.ToolTip>
                    </Button>
                </Border>
            </Grid>
        <Expander DockPanel.Dock="Right" Header="Производители и Поставщики" 
                  Margin="1" Style="{StaticResource Expander}"
                  IsExpanded="False" HorizontalAlignment="Right"
                  ExpandDirection="Right" ToolTip="Производители и Поставщики">
                <Grid Width="250">
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="0.5*"/>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="0.5*"/>
                </Grid.RowDefinitions>
                <TextBlock Text="Производители" Grid.Column="0" Grid.Row="0"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Center">
                </TextBlock>
                <ListBox Name="ManufacturersListBox" ItemContainerStyle="{StaticResource ColorListBoxItem}"
                     HorizontalContentAlignment="Stretch" Grid.Row="1">
                    <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid Height="35">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="15"/>
                                    </Grid.ColumnDefinitions>
                                    <Border Margin="4,4,0,4"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3">
                                        <TextBlock Text="{Binding Path=Name}" 
                                	       HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                    </Border>
                                    <Button Name="DeleteManufacturerButton"
									Grid.Column="1"
									Height="16"
									Width="16"
									Margin="2,0,0,0"
									Style="{StaticResource DelRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Bottom"
                                    Click="DeleteManufacturerButton_Click"
                                    Tag="{Binding}">
                                        <Button.ToolTip>
                                            <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-22">
                                                <TextBlock Text="Удалить"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                    <Button Name="ViewManufacturerButton"
									Grid.Column="1"
									Height="16"
									Width="16"
									Margin="2,0,0,0"
									Style="{StaticResource ViewRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Top"
                                    Click="ViewManufacturerButton_Click"
                                    Tag="{Binding}">
                                        <Button.ToolTip>
                                            <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-22">
                                                <TextBlock Text="Изменить"/>
                                            </ToolTip>
                                        </Button.ToolTip>
                                    </Button>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                </ListBox>
                <Border Grid.Row="1"
                    Style="{StaticResource ListBoxControlPanel}"
                    Width="23" Margin="1,1,0,1"
                    HorizontalAlignment="Left">
                        <Button Name="AddManufacturerButton"
                        Click="AddManufacturerButton_Click"
                        Margin="0,5,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Height="17" Width="17"
                        Style="{StaticResource SearchButton}">
                            <Button.ToolTip>
                                <ToolTip Style="{StaticResource DefaultToolTipStyle}"
								Height="46"
								Width="115"
								VerticalOffset="-29">
                                    <StackPanel VerticalAlignment="Center"
										HorizontalAlignment="Center">
                                        <TextBlock Text="Добавить"
											Foreground="Black"
											HorizontalAlignment="Center"/>
                                        <TextBlock Text="производителя"
											Foreground="Black"
											HorizontalAlignment="Center"/>
                                    </StackPanel>
                                </ToolTip>
                            </Button.ToolTip>
                        </Button>
                 </Border>
                <TextBlock Text="Поставщики" Grid.Row="2"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center">
                </TextBlock>
                <Grid Grid.Row="3">
                    <ListBox Name="SuppliersListBox"
                     VerticalAlignment="Stretch"
					 ItemContainerStyle="{StaticResource ColorListBoxItem}"
                     HorizontalContentAlignment="Stretch">
                        <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Height="75">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="0.5*"/>
                                                <ColumnDefinition Width="0.5*"/>
                                                <ColumnDefinition Width="15"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="0.4*"/>
                                                <RowDefinition Height="0.6*"/>
                                            </Grid.RowDefinitions>
                                            <Border Margin="4,4,0,2"
									Grid.ColumnSpan="2"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3">
                                                <TextBlock Text="{Binding Path=Name}" 
                                	       HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                            </Border>
                                            <Border Margin="4,2,0,4"
									Grid.Row="1"
									Grid.Column="0"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3">
                                                <StackPanel Margin="3" VerticalAlignment="Top">
                                                    <TextBlock Text="Тел.:"
												Foreground="Gray"
												FontSize="10"
												HorizontalAlignment="Left"
												VerticalAlignment="Center"/>
                                                    <TextBlock Text="{Binding Path=Phone}" 
                	                	       HorizontalAlignment="Center" 
											   VerticalAlignment="Center"/>
                                                </StackPanel>
                                            </Border>
                                            <Border Margin="2,2,0,4"
									Grid.Row="1"
									Grid.Column="1"
									BorderBrush="{StaticResource ListBoxItemBorderBrush}"
									BorderThickness="1"
									CornerRadius="3">
                                                <StackPanel Margin="3" VerticalAlignment="Top">
                                                    <TextBlock Text="Адрес:"
												Foreground="Gray"
												FontSize="10"
												HorizontalAlignment="Left"
												VerticalAlignment="Center"/>
                                                    <TextBlock Text="{Binding Path=Address}" 
                	                	       HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                </StackPanel>
                                            </Border>
                                            <Button Name="DeleteSupplierButton"
									Grid.Column="2"
									Grid.Row="1"
									Height="35"
									Width="16"
									Margin="2,0,0,0"
									Style="{StaticResource DelRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Bottom"
                                    Click="DeleteSupplierButton_Click"
                                    Tag="{Binding}">
                                                <Button.ToolTip>
                                                    <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-27">
                                                        <TextBlock Text="Удалить"/>
                                                    </ToolTip>
                                                </Button.ToolTip>
                                            </Button>
                                            <Button Name="ViewSupplierButton"
									Grid.Column="2"
									Grid.Row="0"
									Grid.RowSpan="2"
									Height="35"
									Width="16"
									Margin="2,0,0,0"
									Style="{StaticResource ViewRecButton}"
									HorizontalAlignment="Right"
									VerticalAlignment="Top"
                                    Click="ViewSupplierButton_Click"
                                    Tag="{Binding}">
                                                <Button.ToolTip>
                                                    <ToolTip Style="{StaticResource DefaultToolTipStyle}"
												Height="33"
												Width="75"
												VerticalOffset="-27">
                                                        <TextBlock Text="Изменить"/>
                                                    </ToolTip>
                                                </Button.ToolTip>
                                            </Button>
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                    </ListBox>
                    <Border 
                    Style="{StaticResource ListBoxControlPanel}"
                    Width="23" Margin="1,1,0,1"
                    HorizontalAlignment="Left">
                    <Button Name="AddSupplierButton"
                        Click="AddSupplierButton_Click"
                        Margin="0,5,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Height="17" Width="17"
                        Style="{StaticResource SearchButton}">
                                    <Button.ToolTip>
                                        <ToolTip Style="{StaticResource DefaultToolTipStyle}"
								Height="46"
								Width="115"
								VerticalOffset="-29">
                                            <StackPanel VerticalAlignment="Center"
										HorizontalAlignment="Center">
                                                <TextBlock Text="Добавить"
											Foreground="Black"
											HorizontalAlignment="Center"/>
                                                <TextBlock Text="поставщика"
											Foreground="Black"
											HorizontalAlignment="Center"/>
                                            </StackPanel>
                                        </ToolTip>
                                    </Button.ToolTip>
                                </Button>
                   </Border>
                </Grid>
              </Grid>
            </Expander>
    </DockPanel>       
</Window>
